Skip to content

Commit

Permalink
Python 2 compatibility for print statements [(#2226)](GoogleCloudPlat…
Browse files Browse the repository at this point in the history
…form/python-docs-samples#2226)

* Python 2 compatibility for print statements

* Update beta_snippets.py
  • Loading branch information
nnegrey authored and busunkim96 committed Sep 3, 2020
1 parent 21443c7 commit de90362
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions google-cloud-speech/samples/snippets/beta_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def transcribe_file_with_enhanced_model():
for i, result in enumerate(response.results):
alternative = result.alternatives[0]
print('-' * 20)
print('First alternative of result {}'.format(i))
print('Transcript: {}'.format(alternative.transcript))
print(u'First alternative of result {}'.format(i))
print(u'Transcript: {}'.format(alternative.transcript))
# [END speech_transcribe_enhanced_model_beta]


Expand Down Expand Up @@ -103,8 +103,8 @@ def transcribe_file_with_metadata():
for i, result in enumerate(response.results):
alternative = result.alternatives[0]
print('-' * 20)
print('First alternative of result {}'.format(i))
print('Transcript: {}'.format(alternative.transcript))
print(u'First alternative of result {}'.format(i))
print(u'Transcript: {}'.format(alternative.transcript))
# [END speech_transcribe_recognition_metadata_beta]


Expand Down Expand Up @@ -132,8 +132,8 @@ def transcribe_file_with_auto_punctuation():
for i, result in enumerate(response.results):
alternative = result.alternatives[0]
print('-' * 20)
print('First alternative of result {}'.format(i))
print('Transcript: {}'.format(alternative.transcript))
print(u'First alternative of result {}'.format(i))
print(u'Transcript: {}'.format(alternative.transcript))
# [END speech_transcribe_auto_punctuation_beta]


Expand Down Expand Up @@ -170,8 +170,8 @@ def transcribe_file_with_diarization():

# Printing out the output:
for word_info in words_info:
print("word: '{}', speaker_tag: {}".format(word_info.word,
word_info.speaker_tag))
print(u"word: '{}', speaker_tag: {}".format(
word_info.word, word_info.speaker_tag))
# [END speech_transcribe_diarization_beta]


Expand Down Expand Up @@ -236,7 +236,7 @@ def transcribe_file_with_multilanguage():
for i, result in enumerate(response.results):
alternative = result.alternatives[0]
print('-' * 20)
print('First alternative of result {}: {}'.format(i, alternative))
print(u'First alternative of result {}: {}'.format(i, alternative))
print(u'Transcript: {}'.format(alternative.transcript))
# [END speech_transcribe_multilanguage_beta]

Expand Down

0 comments on commit de90362

Please sign in to comment.