Skip to main content
added 4 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

So far I have written the following and both work:

arcpy.AddField_management("Wards", "test", "SHORT")

iFile =r'\file\Book1.txt'
f = open(iFile, 'r')

What I want to do is populate the new field 'test' with a field (value) from the iFile based on a match on two codes in the seperate file.

The text file has:

Code, Value

Code, Value

I think it might need updateCursor with a where statement ... or an if?

if (code in iFile == code in Wards):
    raise iFile(value) 

So far I have written the following and both work:

arcpy.AddField_management("Wards", "test", "SHORT")

iFile =r'\file\Book1.txt'
f = open(iFile, 'r')

What I want to do is populate the new field 'test' with a field (value) from the iFile based on a match on two codes in the seperate file.

The text file has:

Code, Value

I think it might need updateCursor with a where statement ... or an if?

if (code in iFile == code in Wards):
    raise iFile(value) 

So far I have written the following and both work:

arcpy.AddField_management("Wards", "test", "SHORT")

iFile =r'\file\Book1.txt'
f = open(iFile, 'r')

What I want to do is populate the new field 'test' with a field (value) from the iFile based on a match on two codes in the seperate file.

The text file has:

Code, Value

I think it might need updateCursor with a where statement ... or an if?

if (code in iFile == code in Wards):
    raise iFile(value) 
added 38 characters in body
Source Link
tj123
  • 23
  • 4

So far I have written the following and both work:

arcpy.AddField_management("Wards", "test", "SHORT")

iFile =r'\file\Book1.txt'
f = open(iFile, 'r')

What I want to do is populate the new field 'test' with a field (value) from the iFile based on a match on two codes in the seperate file.

The text file has:

Code, Value

I think it might need updateCursor with a where statement ... or an if?

if (code in iFile == code in Wards):
    raise iFile(value) 

So far I have written the following and both work:

arcpy.AddField_management("Wards", "test", "SHORT")

iFile =r'\file\Book1.txt'
f = open(iFile, 'r')

What I want to do is populate the new field 'test' with a field (value) from the iFile based on a match on two codes in the seperate file.

I think it might need updateCursor with a where statement ... or an if?

if (code in iFile == code in Wards):
    raise iFile(value) 

So far I have written the following and both work:

arcpy.AddField_management("Wards", "test", "SHORT")

iFile =r'\file\Book1.txt'
f = open(iFile, 'r')

What I want to do is populate the new field 'test' with a field (value) from the iFile based on a match on two codes in the seperate file.

The text file has:

Code, Value

I think it might need updateCursor with a where statement ... or an if?

if (code in iFile == code in Wards):
    raise iFile(value) 
deleted 39 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

So far I have written the following and both work:

arcpy.AddField_management("Wards", "test", "SHORT")

iFile =r'\file\Book1.txt' f = open(iFile, 'r')

arcpy.AddField_management("Wards", "test", "SHORT")

iFile =r'\file\Book1.txt'
f = open(iFile, 'r')

What I want to do is populate the new field 'test' with a field (value) from the iFile based on a match on two codes in the seperate file.

I think it might need updateCursor with a where statement ... or an if?

if (code in iFile == code in Wards): raise iFile(value)

any help much appreciated

many thanks

if (code in iFile == code in Wards):
    raise iFile(value) 

So far I have written the following and both work:

arcpy.AddField_management("Wards", "test", "SHORT")

iFile =r'\file\Book1.txt' f = open(iFile, 'r')

What I want to do is populate the new field 'test' with a field (value) from the iFile based on a match on two codes in the seperate file.

I think it might need updateCursor with a where statement ... or an if?

if (code in iFile == code in Wards): raise iFile(value)

any help much appreciated

many thanks

So far I have written the following and both work:

arcpy.AddField_management("Wards", "test", "SHORT")

iFile =r'\file\Book1.txt'
f = open(iFile, 'r')

What I want to do is populate the new field 'test' with a field (value) from the iFile based on a match on two codes in the seperate file.

I think it might need updateCursor with a where statement ... or an if?

if (code in iFile == code in Wards):
    raise iFile(value) 
Source Link
tj123
  • 23
  • 4
Loading