Python中文
首页
教程
问答
标签
搜索
登录
注册
在击打en之前自动添加输入空格
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我对python没有太多的经验,我相信甚至我的标题都是不正确的措辞。我有一个程序,当你输入一个键列表并按回车键时,它会播放一个音符。不过,要想让它工作,你需要在每个键之间按空格键。我想让它接受说eflkjh而不是efl k j h。我该怎么做?在</p> <pre><code>soundBinary = input(" > ") for note in soundBinary.split(): if note == "q": #rest freq = 37 elif note == "w": #b freq = 280 elif note == "e": #b freq = 300 elif note == "r": #b freq = 320 elif note == "t": #b freq = 340 elif note == "y": #b freq = 360 elif note == "u": #b freq = 380 elif note == "i": #b freq = 400 elif note == "o": #b freq = 440 elif note == "p": #b freq = 460 elif note == "a": #b freq = 480 elif note == "s": #b freq = 500 elif note == "d": #b freq = 520 elif note == "f": #b freq = 540 elif note == "g": #b freq = 560 elif note == "h": #b freq = 580 elif note == "j": #high c freq = 600 elif note == "k": #low c freq = 620 elif note == "l": #d freq = 640 elif note == "z": #e freq = 660 elif note == "x": #f freq = 680 elif note == "c": #g freq = 700 elif note == "v": #a freq = 720 elif note == "b": #b freq = 740 elif note == "n": #b freq = 760 elif note == "m": #b freq = 780 winsound.Beep(freq, rate) </code></pre>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>尝试以下操作:</p> <pre><code>for note in soundBinary: if note == "q": .... </code></pre> <p>示例:</p> ^{pr2}$ <p>输出:</p> <pre><code>scottsmudger@ns207588:~ $ python test.py a b c d e f g </code></pre>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
将Pandas数据帧转换为PyTorch张量?
1 回答
将Pandas数据帧转换为scipy稀疏矩阵
10 回答
将Pandas数据帧转换为Spark Datafram时出现问题
1 回答
将pandas数据帧转换为spark DataFram时出错
4 回答
将Pandas数据帧转换为spark datafram时收到错误
2 回答
将Pandas数据帧转换为Spark数据帧
2 回答
将Pandas数据帧转换为Tensorflow数据
5 回答
将Pandas数据帧转换为tkinter obj
6 回答
将pandas数据帧转换为XML
9 回答
将Pandas数据帧转换为值sql语句
4 回答
将pandas数据帧转换为元组
6 回答
将pandas数据帧转换为元组列表
3 回答
将pandas数据帧转换为元组列表并删除所有pandas数据类型
2 回答
将pandas数据帧转换为具有头和数据类型的numpy数组
9 回答
将pandas数据帧转换为内存中的拼花地板,并将其加载到Python中的Hadoop中
9 回答
将pandas数据帧转换为内存中类似文件的对象?
4 回答
将Pandas数据帧转换为内存功能(&F)
7 回答
将pandas数据帧转换为列表列表
8 回答
将pandas数据帧转换为列表列表以输入到RNN
2 回答
将Pandas数据帧转换为单行DataFram
5 回答