title: Less clunky way of checking a string for comma separation in Python?
body: <p>Trying to check a string for comma separation. After I check the string, I'm going to use it to help load a SQL database so the words in the string can't be separated by anything other than a comma. I do have an approach that works but it seems very clunky for Python. Is there a more concise/less expensive way to check a string for comma separation?</p>
  
  <p>Here's my attempt run in a Python 2.7.4 interpreter:</p>
  
  <pre><code># List of possible Strings
  comma_check_list = ['hello, world', 'hello world', 'hello,  world',\ 
                      'hello world, good, morning']
  
  # Dictionary of punctuation that's not a comma
   punct_dict = {'@': True, '^': True, '!': True, ' ': True, '#': True, '%': True,\
                 '$': True, '&amp;': True, ')': True, '(': True, '+': True, '*': True,\ 
                 '-': True, '=': True}
  
  # Function to check the string
  def string_check(comma_check_list, punct_dict):
      for string in comma_check_list:
          new_list = string.split(", ")
          if char_check(new_list, punct_dict) == False:
              print string, False
          else:
              print string, True
  
  # Function to check each character
  def char_check(new_list, punct_dict):
      for item in new_list:
          for char in item:
              if char in punct_dict:
                  return False
  
  # Usage
  string_check(comma_check_list, punct_dict)
  
  # Output
  hello, world True
  hello world False
  hello,  world False
  hello world, good, morning False
  </code></pre>
  
  <p>Thank you in advance for your help!</p>