Questions tagged [txt]

txt is the conventional filename extension of text files.

1467 questions
1
vote
1 answer

How to read text file as list of floats?

This seems like a simple question, but couldn't find it on the Stack community. I have a dataset like the one below in a text file. I would like to read it in as a list with each value as a float. Currently the output is very odd from the simple…
maximus
  • 335
  • 2
  • 16
1
vote
1 answer

.txt to .csv via python delivers csv with only one column

I'm a beginner in python coding I wrote a little script to convert text files in a folder to csv files. The script is running but it delivers a csv file with only one column. Where's my fault? Also the converted files contain always .txt.csv. I…
joho
  • 35
  • 6
1
vote
3 answers

initialize uint8_t array from txt file

I have, in a .txt file, a uint8_t array already formatted, like this: 0x4d, 0x5a, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, What I need is to initialize…
DreamY
  • 13
  • 3
1
vote
2 answers

correctly reading data from a text file with json format in it

Imagine I have a text file with the following two observations: liame@ziggo.nl:horse22| homeAddress = { "city": "AMSTERDAM", "houseNumber": "5", "houseNumberAddition": null, "postalCode": "1111 AN", "street": "Walker", "__typename":…
teller.py3
  • 822
  • 8
  • 22
1
vote
1 answer

How to prevent additional inverted comas duplicated when saving Excel file as txt

I have a Excel file that I want to save as text, but I noticed that the cells that have double inverted comas (") get the double inverted comas duplicated and also these cells get double inverted comas at the beginning/end of the text. For…
Selrac
  • 2,203
  • 9
  • 41
  • 84
1
vote
2 answers

delete a line (.txt-File) containing something - with php

I want to delete a line which contains something given by the $_POST['link'] It already works with the .csv-File. At this point, the code for the .txt-File does nohting. My php code //txt $txt = file('../textFiles/websites.txt'); $fpTXT =…
MtoseD
  • 33
  • 5
1
vote
2 answers

How do I open a file with Python with the file name contained in a String?

Is there a way to open a file, if a word of the filename is contained in a string? Here I have stored the word keys in the variable 'query', I want that if the word 'keys' is the value of the string 'query', it should open the file 'keys in…
user16459815
1
vote
3 answers

Deleting last 10 characters of all txt file names in a directory (Python)

Currently the file names in a directory are 'test1_1_4302929399.txt', 'test1_2_903929029.txt', 'test1_3_3949492929.txt' , how do I delete the last 10 digits in the file names for this directory so that the final is 'test1_1.txt', 'test1_2.txt', etc.…
maximus
  • 335
  • 2
  • 16
1
vote
1 answer

Compare column 2 between two files and print the output with all other columns

I would like to compare two files based on column 2 and print all other columns in the output. File 1: p1 p2 rg se p F Fht 0.3 0.01 0.05 F Tom 0.01 0.004 0.34 File 2: p1 p2 rg se p M Fht 0.2 0.02 0.06 M Ram 0.03 0.004 0.32 Desired output: p1 p2 rg…
kllrdr
  • 169
  • 8
1
vote
1 answer

How to Create a Tibble from many .txt Files, Preserve File Names in a Column, and Use File Names to Sort Files into Categories?

I have 584 .txt files that I would like to merge into one 584 x 4 tibble. Important Background Info: The files can be divided into three categories according to the labels embedded in the file names. Thus: A_1_COD.txt, A_23_COD.txt, A_235_COD,...,…
Á_C
  • 13
  • 4
1
vote
1 answer

How to split text file into multiple text files with custom names (not counters) using regex methods in Python

I wonder if anybody could help me with this challenge. I have a folder with the following files: switch01.txt switch02.txt Each file has the following contents: show running-config Building configuration... Current configuration : 23611 bytes ! !…
atahu
  • 11
  • 1
  • 2
1
vote
2 answers

How do I categorize images based on the description on a txt file?

I have a folder with about 10,000 images, I have a huge *.txt file as follows. The txt file has 30,000 lines. Each image has three lines, line (1) contains the image name for example "04406_8_074402.jpeg". Line (2) contains the image category, in…
1
vote
1 answer

Power Query does not recognize tab as a delimiter in .txt files in the code

this is my first post here, so I apologize in advance if the question has been already answered somewhere or I do something wrong. To summarize the problem: I am doing some spectroscopy measurements and the data from the software I am using is saved…
emir
  • 13
  • 2
1
vote
1 answer

How do you read in a .txt file with vertical bar separators (while ignoring other possible separators) in R?

My text data is consistently separated by vertical lines ("|"), but the text between the vertical lines is rarely consistent and often includes characters that could be used as separators ("-", ",", and carriage returns). I would like there to only…
ArlJerry
  • 11
  • 2
1
vote
2 answers

Python: extract floats from txt files

I have this txt file: TP 0.8329 And i tried to extract that float after "TP" using the following code: def definir_operacao(): end = 0 oper = [] for x in range(len(lines[0])): if(lines[0][x] == " "): end += 1 …