Questions tagged [txt]

txt is the conventional filename extension of text files.

1467 questions
-2
votes
2 answers

Hi so some of my code doesn't wanna get recognized and some of it doesn't wanna show up

So if you look at line 4 and 12 you see when i register everything the user puts in should show up in the txt file but i doesn't and if you look at line 38 it give's me an error it tells me that everything i have put in between the parentheses is…
-2
votes
3 answers

Create text file in folder

I'm trying to create a text file that is named using a variable in my program. Only problem is, I can't specify a directory when i'm naming it using a variable. (vac_postcode is the variable i'm using to name the file) centrebypostcode =…
VIMAL RICH
  • 37
  • 6
-2
votes
3 answers

Python Writing a List into a Text Document With formatting

I need to be able to make python create a new text document that shows the list in a certain way and I am unsure of how to use formatting within the text creation area def write_to_file(filename, character_list): ### Using a while loop to iterate…
Jayden
  • 11
  • 7
-2
votes
1 answer

How to read multiple input files and write into a new file in txt and excel in C++?

I used to run a calculation by reading from 1 txt file ("1_Hello.txt"), calculate and output by functions, and write the output into a new txt file. But now I have 5000 txt files ("1_Hello.txt" to "5000_Hello.txt"). I want to read all 5000 txt…
kingsley
  • 27
  • 5
-2
votes
3 answers

Automate text formatting in Python

I have a txt file containing a list of country codes for each line. The format is like this: AL DZ AS AO AI BS BB BY BJ BA I would like to format the text using Python, adding quotation marks for each country code, followed by a…
-2
votes
1 answer

Split txt file by Year and ID and rename each new txt file as "Year_ID.txt"

I have a bunch of txt files (comma separated) and I want to split the file into separate text files by using common group identifiers from Column 1(Year) and Column 3(ID). Also, I would like to save the new filenames as "Column1_Column3.txt".I do…
Ivy
  • 1
  • 2
-2
votes
1 answer

can't encode character '\u0144' even using encoding=utf-8 in python3

I am trying to read some information from some .txt files, they are all in english and they do not have any other unicode character, the problem is that for an especific file it just crashed and do not show the information, the error is Traceback…
jhonny
  • 805
  • 4
  • 10
-2
votes
3 answers

How can I extract one column out of my txt file into a list (Python)?

I have a txt file with multiple columns and each column is different in length and separated by a different number of spaces. I just want to get one column out of that list. For example: I want to get the fifth column out of the list to print. I…
-2
votes
2 answers

convert txt file to json file in C# console application

I need to convert .txt file to j son file in C# console app
Mathembi
  • 17
  • 1
  • 5
-2
votes
1 answer

Deleting a row from a file if it has x number of columns using java

I have a .txt or a .xlsx with a lot of rows and 4 or 5 columns. I would like to write a java program that deletes all the rows that have 5 columns. How would I read the data and delete the rows based on the number of columns? Delete row which has…
-2
votes
3 answers

How to edit a .txt file using python where I want to paste a specific string after every number

9418012345, hello world. 9418154321, hello world. 94xxxxxxxx, hello world. . . . . . . . 1000 mobile number but same message. I already have mobile numbers pasted in every line. How can I add comma and same message after all numbers.
-2
votes
3 answers

How to change list of string to list of elements (numbers)?

When I use: with open("test.txt") as file read = csv.reader(file) for i in read: print(i) and I have got something like that: ['[0', ' 0', ' 1', ' 0]'] and I need: [0, 0, 1, 0] Any advises please?
pd13
  • 13
  • 1
  • 5
-2
votes
2 answers

Making dictionary with text file python

I have a question making a dictionary with text file. I have a text file like this: 0,1 0,2 0,3 1,2 1,3 1,4 2,3 2,4 2,5 What I am trying to do, I would like to make {0: [1,2,3], 1:[2,3,4], 2:[3,4,5]} like this lists = {} test = open('Test.txt',…
NEWBIEOFPYTHONS
  • 85
  • 1
  • 1
  • 7
-2
votes
1 answer

Writing rows in columns in txt python

I have txt file like this: Name | Class | Points -------------------------- Name1 | (2) | 30 Name1 | (3) | 50 Name1 | (5) | 15 Name2 | (1) | 25 Name2 | (3) | 88 Name2 | (4) | 3 There are 100 unique values under the…
-2
votes
1 answer

How to read 2 columns of .txt file & store it in x & y variables in python

This is the data of .txt file.(2 columns) 6.1101,17.592 5.5277,9.1302 8.5186,13.662 7.0032,11.854 5.8598,6.8233 8.3829,11.886 7.4764,4.3483 8.5781,12.0 6.4862,6.5987 5.0546,3.8166 5.7107,3.2522