Questions tagged [txt]

txt is the conventional filename extension of text files.

1467 questions
1
vote
1 answer

How to remove tags and page numbers from txt files?

I have some txt files and I would like to remove tags and page nums from them. My txt file looks like this: txtfile = """
header contents
The following discussion should be read in conjunction with our…
1
vote
1 answer

Why fscanf in c reads csv files wrong?

I am making a linked list of World Cup teams, when loading the teams I need to do a preload reading data from a csv file but reading 2-word countries makes it wrong For example Suppose that this is the csv file: Arabia Saudita, Herve, Renard,…
Kalifeh
  • 33
  • 4
1
vote
1 answer

How to process the data from a table.txt file from a series of folders and save the output in the same folder using Matlab?

Could you please help me to read the data from a table.txt in a series of subfolders from a directory? In all the subfolders, the output to read has the same name, 'table.txt'. I want to process the data and save the output in the same folder. I can…
Sateesh
  • 25
  • 4
1
vote
2 answers

.txt file is opening but prints nothing

I'm trying to open a text file and print it as a string. I've made sure there is text in the .txt file but when I run the code it just prints an empty space, I don't know what to do at this point since I couldn't find anything that could help me…
Shoof
  • 11
  • 1
1
vote
1 answer

How to open make hyperlink for txt files

I created 3 text files and I want to create a bullet form list with hyperlinks that will direct the user to each file created. How can I code this? echo "
yermteam
  • 35
  • 4
1
vote
1 answer

Simple way to convert txt file from UTF-8 to ASCII

I am trying to convert just one file from UTF-8 to ASCII. I found the following script online, and it creates the Out-File but it does not change the encoding to ASCII. Why is this not working? Get-Content -Path "File/Path/to/file.txt" | Out-File…
Crimp
  • 389
  • 1
  • 22
1
vote
1 answer

Split CSV file which contains multiple tables into different pandas dataFrames (Python)

I have multiple CSV files which are formatted with multiple tables inside separated by line breaks. Example: Technology C_inv [MCHF/y] C_maint [MCHF/y] NUCLEAR 70.308020 33.374568 HYDRO_DAM_EXISTING 0.000000 195.051200 HYDRO_DAM 67.717942 …
OliviaJ
  • 13
  • 3
1
vote
2 answers

Sort a txt file based on numbers

I have a txt file of data that looks like this: @0 #1 @30 #2 @750 #2 @20 #3 @500 #3 @2500 #4 @460 #4 @800 #1 @2200 #1 @290 #2 @4700 #4 @570 #1 How do I sort the file based on the integer between the @ and #? The output should be: @0 #1 @20 #3 @30…
Neeraja
  • 98
  • 6
1
vote
1 answer

How to make with with ?

On the welcome page after the user has signed in, if I add this line of code and I replace “my_username_here.txt” with “john.txt”, it pulls what is saved on john.txt and shows it on the welcome…
wqyutv
  • 17
  • 5
1
vote
3 answers

decode string "2A4CT2A2C..." into "AACCCCTAACC..." from a text file to another

I have a doc.txt which is like "2A4CT2A2C..." and i want to get "AACCCCTAACC..." and then write it to another doc1.txt I have tried: (origin and destination are the paths of the docs) def decode_txt(origin, destination): h = open(destination,…
vanquish
  • 31
  • 4
1
vote
1 answer

Merge two list to create a table in a txt file in python

I want to merger these two list in one list that should look like this : newlist = ['Salle 13\tBullet, Train Carter\n','Salles 06\t Sita Ramam, L’année du requin\n'...] so each "salle" will have two names Here the two list needed to…
Az7
  • 25
  • 3
1
vote
1 answer

Why does replacing the file contents within an ArrayList return unwanted results?

How do I add the file line I have edited to the same line I got the contents from my txt file? 1,House mack,house,123 mack road,155,40000,40000,2022-09-29,no,Bill,123456,bill@gmail.com,12 Bill road,Jack,456789,jack@gmail.com,23 Jack…
chris
  • 13
  • 3
1
vote
1 answer

Fill in empty space by merging columns using Pandas Python

I am a Python noob. I have an unstructured text file that I'm trying to capture to a dataframe and export to excel. I need to merge 38 to 36, 45 to 43, and 79 to 78 filling in the empty space with the data on the merging column. Dummy…
Dhakshika
  • 49
  • 7
1
vote
3 answers

Move X amount of lines from one text file to another using bash

I am trying to combine two TXT files somewhat randomly and to do this I am trying to use head and sed to move X amount of lines to a new file and delete the lines from the old file. The problem is, because it is a random value, I can't tell sed just…
1
vote
1 answer

Reading a text file using Pandas accurately in Python

I am trying to read B.txt using pandas. It prints the value of B but not as a list. I present the current and expected outputs. import pandas as pd df = pd.read_csv("B.txt", header=None) B = df. to_numpy() B=B.tolist() print("B =",B) The current…
user20032724
  • 153
  • 5