Issue creating .txt file with long name

165 views Asked by At

I am trying to create a series of text files with reasonably long names (but nowhere near 260 characters). An example file name is:

Premier_League-Tottenham v Manchester City-Saturday, Aug 14 2010-12:45-0-0-410996-Home-Team-2010-2011-30-2015-06-14.txt

The code I am using to generate this looks like:

mylogprint = "Premier_League" + '-' + str(the_home_name) + ' v ' + str(the_away_name) + '-' + str(the_match_date) + '-' + str(the_match_time) \
                            + '-' + str(the_ft_score) + '-' + str(matchid) + '-' + num_list2 + '-' + myseasonstart + '-' + myseasonend + '-' + str(slot_list2)  + '.txt'

However, the file is being created as:

Premier_League-Tottenham v Manchester City-Saturday, Aug 14 2010-12

Here half the file name is missing, including the '.txt' on the end. Can anyone tell me what the issue is here?

Thanks

1

There are 1 answers

2
paolov On BEST ANSWER

if you are working with files in windows, colon (:) is an invalid character in a filename.