>>> w
['Parts-of-speech', 'disambiguation', 'techniques', '(', 'taggers', ')',
'are', 'often', 'used', 'to', 'eliminate', '(', 'or', 'substantially',
'reduce', ')', 'the', 'parts-of-speech', 'ambiguitiy', 'prior', 'to',
'parsing.', 'The', 'taggers', 'are', 'all', 'local', 'in', 'the', 'sense',
'that', 'they', 'use', 'information', 'from', 'a', 'limited', 'context',
'in', 'deciding', 'which', 'tag', '(', 's', ')', 'to', 'choose', 'for',
'each', 'word.', 'As', 'is', 'well', 'known', ',', 'these', 'taggers',
'are', 'quite', 'successful', '.']
>>> q=open("D:\unieng.txt","w")
>>> q.write(w)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: argument 1 must be string or read-only character buffer, not list
Use writelines()
method to write your content.
>>> f = open("test.txt",'w')
>>> mylist = ['a','b','c']
>>> f.writelines(mylist)
file.writelines(sequence)
Write a sequence of strings to the file. The sequence can be any iterable object producing strings, typically a list of strings. There is no return value
Note: writelines()
does not add line separators.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With