コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
5358 ビュー
how to add character  ' to   shippers company so the result is shipper's company 

header += 'Pickup Time,Shippers Company,Shippers Name,Shippers Phone No.,Shippers Address 1,Shippers Address 2,Shippers Postal Code,Consignees Company,Consignees Name,Consignees Phone No.,Consignees Address 1,Consignees Address 2,Consignees Postal Code,Comments\n'


hope you understand what i mean.

thanks in advance

アバター
破棄

Try to this way header = "Shipper's Company".

著作者

thankns brother

最善の回答

To handle this situation, you could opt for 4 options:

1. use single quotation inside a double quotation string (as Farid suggested)
e.g.  "Shipper's Company".
2. use multi line string 
e.g. """ Pickup Time,Shippers Company,Shippers Name,Shippers Phone No.,Shippers Address 1,Shippers Address 2,Shippers Postal Code,Consignees Company,Consignees Name,Consignees Phone No.,Consignees Address 1,Consignees Address 2,Consignees Postal Code,Comments\n"""
3. use escape character
e.g. 'Shipper\'s Company'
4. use of raw string 
e.g. r"Shipper's company"    # mostly used in matching expression of regular expression at python

アバター
破棄
関連投稿 返信 ビュー 活動
2
1月 23
26205
4
6月 21
39365
1
12月 20
2601
1
4月 18
7681
3
9月 15
9533