Adam Johnson
Adam Johnson

Reputation: 13

Writing Integers to a text file

New to Python, I am writing integers to a text file for a program, but once the numbers go above 10 the program fails to work. Therefore, I want to add a space after every integer, I have tried a few ways to do this but however it's not been working.

Here is one way in which I tried to do so:

positions = int(uq_words.index(i) + 1, (" "))

I added the (" ").

I realise that this is probably a really basic problem to solve.

Upvotes: 1

Views: 946

Answers (1)

Cedric Druck
Cedric Druck

Reputation: 1041

try something like " ".join(uq_words) and then write to file

Upvotes: 1

Related Questions