我正在用Spim用MIPS编写一个程序,我想把温度转换成华氏和摄氏。例如:Enter the Temperature: C因此,我很难让程序识别用户输入"C“或"F”并跳转到相应的标签。下面是我遇到麻烦的代码的一部分:
li $v0, 8 # Loads System service to read string
我正在寻找一种将变量(可以是ASCII字符串、带有额外字符的unicode字符串,如é或£,或者浮点数或整数)转换为unicode字符串的方法。variable.encode('utf-8'),其中variable是整数,结果为AttributeError: 'int' object has no attribute