Python留下“\”(PC与Mac的差异)

时间:2016-08-04 00:22:15

标签: python stripping

我是Python的新手,所以任何帮助都会受到赞赏。

我在PC上的一个类中编写了以下代码,它没有任何问题。

word = raw_input('Word: ')
f = open('dictionary.txt','r')
for line in f:
    line = line.strip()
    #print(line)
    if sorted(line) == sorted(word):
        print(line)
f.close()

当我将相同的东西放到Mac上时,行末端仍然有一个“\”(即“apple”),因此与我输入的内容不匹配。 有什么我想念的吗?

0 个答案:

没有答案
相关问题