2

I'm working with Tweepy, so I'm running into a problem where I need to change a status object to type String.

I looked over the Tweepy Documentation and couldn't find any information on how to. I've tried a couple of things but had no luck.

for s in tweet:
    sn = s.user.screen_name
    m = "@%s Nice Post" % (sn)
    s = api.update_status(m, s.id)
Kevin
  • 74,910
  • 12
  • 133
  • 166
Dexter
  • 31
  • 2
  • Did you try `str()` on the status object? – cdarke Jan 13 '18 at 22:32
  • Possible duplicate of [Converting integer to string in Python?](https://stackoverflow.com/questions/961632/converting-integer-to-string-in-python) – Spence Wetjen Jan 13 '18 at 22:42
  • @cdarke it was the first thing I tried, had no luck with it. – Dexter Jan 13 '18 at 22:45
  • Possible duplicate of [Convert Tweepy Status object into JSON](https://stackoverflow.com/questions/27900451/convert-tweepy-status-object-into-json) – match Jan 13 '18 at 23:01
  • Possible duplicate of [Convert Tweepy Status object into JSON](https://stackoverflow.com/questions/27900451/convert-tweepy-status-object-into-json) – DYZ Jan 14 '18 at 01:04

1 Answers1

1

Let's say "tweet" is a "tweepy.models.Status" object, you can convert it to a string like so:

import json
json.dumps(tweet._json)
George Liu
  • 3,601
  • 10
  • 43
  • 69