2014년 12월 8일 월요일

Key pair format question

I would like to create a deck of cards using key pairs.  What is the proper format for the pairs?  My format for the cards (keys) and values are as follows :

Ace of Spades would be:

Key AS 
Value 20

Two of Spades would be:

Key 2S 
Value 21

etc

I've attached my code that keeps giving me fits.  I've also tried straight text.




Basically, How do I turn this data:   
((AS 20)(2S 21)(3S 22)(4S 23)(5S 24)(6S 25)(7S 26)(8S 27)(9S 28)(TS 29)(JS 30)(QS 31)(KS 32)(AH 120)(2H 121)(3H 122)(4H 123)(5H 124)(6H 125)(7H 126)(8H 127)(9H 128)(TH 129)(JH 130)(QH 131)(KH 132)(AD 220)(2D 221)(3D 222)(4D 223)(5D 224)(6D 225)(7D 226)(8D 227)(9D 228)(TD 229)(JD 230)(QD 231)(KD 232)(AC 320)(2C 321)(3C 322)(4C 323)(5C 324)(6C 325)(7C 326)(8C 327)(9C 328)(TC 329)(JC 330)(QC 331)(KC 332))

into a properly formed  pairs where must be a list of pairs, that is, a list where each element is itself a list of two elements.





a correct csv table looks like this:

AS,20
2S,21
3S,22
etc...

note the comma between each element and the new line after each row
try again with a correct cv table



I had to format my text like this to get it to work:

AS,20\n2S,21\n3S,22\n4S,23\n5S,24\n6S,25\n7S,26\n8S,27\n9S,28\nTS,29\nJS,30\nQS,31\nKS,32\nAH,120\n2H,121\n3H,122\n4H,123\n5H,124\n6H,125\n7H,126\n8H,127\n9H,128\nTH,129\nJH,130\nQH,131\nKH,132\nAD,220\n2D,221\n3D,222\n4D,223\n5D,224\n6D,225\n7D,226\n8D,227\n9D,228\nTD,229\nJD,230\nQD,231\nKD,232\nAC,320\n2C,321\n3C,322\n4C,323\n5C,324\n6C,325\n7C,326\n8C,327\n9C,328\nTC,329\nJC,330\nQC,331\nKC,332


댓글 없음:

댓글 쓰기