473,327 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

How to create temp file in memory???

A.T.T

Thanks a lot.
Oct 5 '05 #1
5 5796
Here's how:

1. open your web browser
2. visit the url http://docs.python.org
3. click the link "Library Reference" (keep this under your pillow)
4. scan down the list of modules until you see these two items:
4.6 StringIO -- Read and write strings as files
4.7 cStringIO -- Faster version of StringIO
5. ?????
6. profit

Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDQ+oGJd01MZaTXX0RArg4AJ440SZ8LdMEakO/KMscH6tDMTLHugCdGJ/C
72cNpx7bGhixH1wgQIP1QYE=
=Trj+
-----END PGP SIGNATURE-----

Oct 5 '05 #2
Wenhua Zhao wrote:
A.T.T

Thanks a lot.

If you could elaborate a bit more, it might be helpful. I'm guessing
you want something like StringIO or cStringIO.
- jmj
Oct 5 '05 #3
I have a list of lines. I want to feed these lines into a function.
The input of this function is a file.
I want to creat a temp file on disk, and write the list of lines into
this temp file, then reopen the file and feed it to the function.
Can I create a this temp file on memory???

Jeremy Jones wrote:
Wenhua Zhao wrote:
A.T.T

Thanks a lot.

If you could elaborate a bit more, it might be helpful. I'm guessing
you want something like StringIO or cStringIO.
- jmj

Oct 5 '05 #4
Wenhua Zhao wrote:
I have a list of lines. I want to feed these lines into a function.
The input of this function is a file.
I want to creat a temp file on disk, and write the list of lines into
this temp file, then reopen the file and feed it to the function.
Can I create a this temp file on memory???

Jeremy Jones wrote:

Wenhua Zhao wrote:
A.T.T

Thanks a lot.

If you could elaborate a bit more, it might be helpful. I'm guessing
you want something like StringIO or cStringIO.
- jmj

If the function takes a file object as an argument, you should be able
to use StringIO or cStringIO.
- jmj
Oct 5 '05 #5
Wenhua Zhao wrote:
I have a list of lines. I want to feed these lines into a function.
The input of this function is a file.
I want to creat a temp file on disk, and write the list of lines into
this temp file, then reopen the file and feed it to the function.
Can I create a this temp file on memory???


Yes, the answer has been given to yoou already: (c?)StringIO will help you.

Diez
Oct 5 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Frank Millman | last post by:
Hi all I need to generate potentially large reports from a database, and I want to offer the option of print preview before actually printing (using wxPython). I figure that the best way to...
3
by: Wiggy | last post by:
Hi, It's probably easiest if I describe what I'm trying to do: I have several tables I want to base a query on. In addition I have some dynamic data that I want to join against that consists...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
4
by: Jeff Rodriguez | last post by:
Main just loops over this while it's not null. The segfault occurs at this line: *line = (char)ch; Also, please don't just fix the code. I would like to know why exactly this isn't working so I...
10
by: robwharram | last post by:
Hi, I'm quite frustrated in the fact that I can't even display a simple "Hello World" message on .Net. I've been through all of the groups and searched all over the place and haven't been able...
8
by: Paw | last post by:
Greetings. I use asp. what I need is is when a visitor comes to the site, I need it to check the host name. if "www.hometowndigest.com" is the host, then check a folder named "something" and if...
34
by: Tom | last post by:
I'd greatly appreciate advice and code snippets on how to create a ram disk within a C/C++ program. I also need to be able to determine the free space. Thanks in advance for any help.
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
2
by: Burbletrack | last post by:
Hi All, Hope someone can help me... Im trying to highlight the advantages of using table variables as apposed to temp tables within single scope. My manager seems to believe that table...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.