学生们无法理解的事情
From aiogram.types import InputFile
a = InputFile(r'C:\Users\Acer\Desktop\f\1.mp3')
b = InputFile(r'C:\Users\Acer\Desktop\f\2.mp3')
c = InputFile(r'C:\Users\Acer\Desktop\f\3.mp3')
d = InputFile(r'C:\Users\Acer\Desktop\f\4.mp3')
e = InputFile(r'C:\Users\Acer\Desktop\f\5.mp3')
class Make:
def __init__(self, art, zanr, name, put):
self.art = art
self.zanr = zanr
self.name = name
self.put = put
a1 = Make('Blaze', 'Hip-hop', 'Music_1234', a)
b1 = Make('PORCHY', 'Rap', 'Trak_28', b)
c1 = Make('Blaze', 'Pop', 'North-abc', c)
d1 = Make('PORCHY', 'Hip-hop', '26-83', d)
e1 = Make('Blaze', 'Pop', 'Abnov', e)
spis = [a1, b1, c1, d1, e1]
for x in range(0, 4):
if spis[x].art == 'PORCHY':
print(cl.spis[x].put)
控制台:
<InputFile 'attach://GqEaqV-Wj3zekeFP9GIygA' with file='<_io.BufferedReader name='C:\\Users\\Acer\\Desktop\\f\\2.mp3'>'>
<InputFile 'attach://JeYgSuIUgVjS7nDwPONivQ' with file='<_io.BufferedReader name='C:\\Users\\Acer\\Desktop\\f\\4.mp3'>'>
为什么不呢
C:\Users\Acer\Desktop\f\2.mp3
C:\Users\Acer\Desktop\f\4.mp3
通过查看InputFile source code,您可以看到
__str__
方法的定义如下:并且
__repr__
方法等于__str__
如果您只想打印文件的路径,我相信您应该使用
相关问题 更多 >
编程相关推荐