Project

General

Profile

« Previous | Next » 

Revision 4696

Removed no longer used ucase_first

View differences:

bin/ucase_first
1
#!/usr/bin/env python
2
# Uppercases the first character of columns in a spreadsheet
3

  
4
import csv
5
import sys
6

  
7
def ucase_first(str_):
8
    if str_ == '': return str_
9
    else: return str_[0].upper()+str_[1:]
10

  
11
def main():
12
    col_nums = sys.argv[1:]
13
    if col_nums == []:
14
        raise SystemExit('Usage: '+sys.argv[0]+' col_num... <map >out_map')
15
    col_nums = map(int, col_nums) # 0-based
16
    
17
    # Process map
18
    reader = csv.reader(sys.stdin)
19
    writer = csv.writer(sys.stdout)
20
    for row in reader:
21
        for i in col_nums: row[i] = ucase_first(row[i])
22
        writer.writerow(row)
23

  
24
main()
25 0

  

Also available in: Unified diff