>The two sentences I would like to use in the program is the following: >"This is line one\nThis is line two!" so I write: text_message = "This is line >one\nThis is line two!" >The dictionary name and key/value pairs will be: >my_sentences {'This':'This','is':'is','line':'line','one':'two'} # Does this >code split the words of each sentence so that the words in sentence 1 are >keys, and the words in sentence 2 are values?
That code does not split anything; it manually hard codes the results you want! Although the dictionary you show is where each word in sentence one is the key for the corresponding word in sentence two. Based on your description, I was thinking you wanted something more like my_sentences = { 'This is line one': 'This is line two' } What happens for 1 sentence or 3 sentences? What if the sentences are not the same length? This type of manipulation makes sense for handling tabular data, but not sure exactly what your use case is... Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX 77002 work phone: 713 - 216 - 5423 -- This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor