How to cat None

LittlePython LittlePython at lost.com
Tue Feb 14 22:23:45 EST 2006


I found out the hard way that I can not cat None. I get an error. Is there a
simple way to cat None without doing some kind of equation  ( if this then
that). Is there a isNone() somewhere. I am not too sure I know what None
really means.

I include an example to show what I am talking about in case I am alittle
confused.




from easygui import *
import string

msgbox('Starting Program')

thisfile = fileopenbox(msg='Choose the correct File', title='Matrix Input
File')
input = file(thisfile,'r')

header = string.split(string.strip(input.readline()),',')
header.extend(['55FirstName',
'55Intial','55LastName','55Alias',])

all = input.readlines()
input.close
input = None
matrix = {}
for user in all:
    user1 = string.split(string.strip(user),',')
    user1.extend(['None']*4)    <-------------------------I would like to
None  or better NULL this instead of string it
    user1 = dict(zip(header,user1))
    matrix[user1['OldNTLogon']] = user1

mychoice = choicebox(choices=matrix.keys())
user1 = matrix[mychoice]

alltogether = ''

for KeyName in user1.keys():
    if alltogether == '':
        alltogether = KeyName + '=' + '  ' + user1.get(KeyName) + '\n'
    else:
        alltogether = alltogether + KeyName + '=' + user1.get(KeyName) +
'\n'  <------- error 'can not cat None with a str' or something like that

msgbox(alltogether,'User Matrix for '+ mychoice )

msgbox('The End')





More information about the Python-list mailing list