WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-19-2008, 09:58 AM
Uttama_vizard Uttama_vizard is offline
Member
 
Join Date: Sep 2007
Posts: 60
Read file....many issues

I am working with a text file and trying to read it.

The text file is as follows:

Data properties:
.
.few lines
.

5 1 -1280 -1024 -1.000 -1.000 -1.000 -1.000 4 -1280 -1024 -1.000 -1.000 -1.000 -1.000 4
.
.
.
My 21st line starts with '5' as shown. From this line onwards, the data is important to me and which I want to read.

1st question:

file = open('Test.txt', 'r')
f = file.read()
print f

These lines of code prints whatever is in the text file. But, I want to selectively pick up the lines important to me (say from 21st line onwards).

2nd question:

string1 = []
string2 = []
for line in file: s = line.split() string1.append(s[0]) print string1 string2.append(s[1]) print 'abcd'
file.close()

When I am using this code, I am getting the following error message:

string1.append(s[0])
IndexError: list index out of range

But, I want to gain access to all (say about 16 strings).

Question 3:

I want to use these string values, to initiate some other actions. How do I do that.

Question 4:

I want to access this text file from another computer which is generating this data from some other application. Is there any easy way, by which I can get access to this text file on a real time basis while working in the vizard environment.

Sorry to ask so many questions...what to do...simply got stuck up in solving these issues.

If somebody can give me some valuable suggestions...that would be wonderful.

Thanks

Uttama
Reply With Quote
 

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Could not find plugin to load objects... halley Vizard 1 05-30-2006 11:01 AM
file input vsully Vizard 1 12-21-2004 10:51 PM
avatar head texture issues rconrey Vizard 3 11-17-2004 04:05 PM
Closing file handles from within function FlyingWren Vizard 1 10-01-2003 06:02 PM
I cannot show wrl file with text node sled Vizard 3 06-25-2003 07:52 AM


All times are GMT -7. The time now is 09:53 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC