Questions tagged [txt]

txt is the conventional filename extension of text files.

1467 questions
-1
votes
1 answer

Move files one by one to newly created directories for each file with Python 3

What I have is an initial directory with a file inside D:\BBS\file.x and multiple .txt files in the work directory D:\ What I am trying to do is to copy the folder BBS with its content and incrementing it's name by number, then copy/move each…
-1
votes
2 answers

How to read and write a txt file outside of project folder (Unity)

I tried using File, StreamWriter and StreamReader with a path outside of my project folder but it didn't work. It became projectPath\externalPath. For example my project path is F:\Project\ and my txt file is in D:\File.txt, Unity automatically read…
-1
votes
1 answer

How to search for keywords in a txt-file and print full string out

Hello i am using python combined with txt file and want to let my code search for parts of a word, like my txt file looks like this = 'www.test.com/product/wings' , 'www.test1.com/product/chicken' , 'www.okay.com/product/burger' ,…
Yves1234
  • 35
  • 1
  • 7
-1
votes
3 answers

Convert a TXT file to float array python

I have TXT file with float numbers. I can not convert it to float array in python. f = open('Vmat.txt', 'r') DATA = f.read() DATA = DATA.split("\n") for i in range(0,len(DATA),1): DATA[i] = DATA[i].replace(",","") DATA[i] =…
-1
votes
2 answers

Is there an external library or a simple function to replace/remove special characters in Strings for Flutter(dart)

App Screenshot How I got data from the txt file. Future? get textAsString async { Uri? uri = Uri.tryParse(text.url); if (uri != null) { String text = await http.read(uri); return text; } return ''; } My widget structure and…
Rezia
  • 35
  • 1
  • 6
-1
votes
1 answer

OSError when loading txt file in numpy

I have a problem loading a txt file from a Google drive to numpy. It got OSError. I put all the .py file and txt file in the same folder but it didn't work. I read through some similar topics and it seems like it may be because the file is made from…
Vince
  • 1
-1
votes
1 answer

Python: skip lines and split into columns text file

I have a txt file, which looks like that: Description Description 0 0 170. 170. 40.02 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 18.09228 1 0 170. 170. 70.80 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 …
Yuliya
  • 1
  • 1
-1
votes
1 answer

Dynamically increase array size in C using realloc

I'm trying to save the element of a file into an array of structs. I want to dynamically increase the memory allocated in the array to fit just the total amount of lines (structs) in my file. The .txt file looks like…
Rodrigo Guzman
  • 487
  • 2
  • 9
-1
votes
5 answers

Create a dictionary from a txt file

I have a txt file that I want to convert in a dictionary. Every file of the txt is made up of four str separated by semicolon. Each str will be the value of the dictionary. I tried the code below, but I am stack how to continue. text =…
-1
votes
1 answer

C function call error display function using txt file

when I call display function it doesn't call in program and when I use this in main function without using it in function it works perfectly. #include #include #include #include int main() { int d; int…
-1
votes
1 answer

How do I send the output into txt file? Do I need to import OS?

Here is the code: import random def random_gen(): return f".type('ffi{random.randint(1, 22)}-{random.randint(1000000, 9999999)}')" for _ in range(5559999): print(random_gen())
Admin
  • 13
  • 2
-1
votes
1 answer

Read until empty line and save as new file - python

first of all, completely new to python, so this question might be easy. I want to read a text file and save it as a new file, separate the header in emails from the body. The place where the header ends is the empty line under "X-UID: 81" (as seen…
-1
votes
1 answer

Can I change only the numbers in txt file?

Let's say I want to have a file with something like this " Milk 10 Bread 5 Eggs 6 " I want to add a button or something that would allow me to input any numner to change only the number(price) on the one that I choose. How can one do that? Thanks!
Virtua
  • 1
-1
votes
1 answer

how to replace spaces to underscores in java

I have a text file named read.txt that says "JAVA PROGRAMMING" and i want to copy it to another file named write.txt and replace the space into underscore like this: "JAVA_PROGRAMMING". Big thanks to anyone who would help :) My code: import…
Noran
  • 13
  • 4
-1
votes
3 answers

supress /n at the end of the txt file

I have the following code: with open(path, 'r') as f: data = f.readlines() print("x "+ data[1] + "y") data[1] is the string from txt file. The result that I get: >>> x 10 >>> y but I would like "y" to be in the same line with "x 10". Is it…
Rostyslav
  • 85
  • 1
  • 1
  • 5