Hello, I have a pipe delimited data file that I need to read and strip all fields (if necessary) to meet SQL column restraints (for import). In Python, I use rstrip and it works even when a column, for example - Company Name(30) or FirstName(16), LastName(16), etc is null. I could use substring but a number of "IF" tests would be needed for each variable. Any better ideas? Here's an example of my python code:
print(fields[0][:10].rstrip() + "|" +
fields[1][:30].rstrip() + "|" +
fields[2][:16].rstrip() + "|" +
fields[3][:2].rstrip() + "|" +
fields[4][:16].rstrip() + "|" +