大家一定有过这样的问题:为什么在使用一些模块的时候总是会报错呢?这和版本有一定的问题。我用的是python3.6.5版本,就像之前有谁发过一篇有关于python几个小玩具的文章,他用的版本应该是3.8.5。我试过他文章里的所有图片写的代码,但是都失败了。
每一次,它都提示没有模块。我简直要被气炸了,为什么呀?后来,我搜过资料,有些旧版本没有新版本的东西,因此,我更新了版本,这才发现,原来真是版本问题。大家有兴趣可以尝试用3.6.5版本使用3.8.5版本的模块,看看是否如此。
大家看看下面代码,在.3.6.5版本中试试。
import cowsay
cowsay.dragon('┗|`O′|┛ 嗷~~')
(@焦虑的小学生,我真的没素材了……)
希望大家能多提供代码!
from better_profanity import profanity
censored_text = profanity.censor("son of bitch")
print(censored_text)
# son of ****
import os
import platform
import sys
import time
from IPython.display import clear_output as clear
def run():
text = "凤朝阳,鹏北海,又携书剑路茫茫。"
while True:
if platform.system().lower() == 'windows':
os.system("cls")
elif 'ipykernel' in sys.modules:
clear()
else:
os.system('clear')
print(text)
time.sleep(0.3)
text = text[1:] + text[0]
if __name__ == '__main__':
run()
这是我第一篇文章,希望大家可以支持一下~