What are the different formats in which code snippets are stored in StackOverflow data dumps?

86 views Asked by At

I am aware that code snippets are stored between tags <pre><code> and </code></pre>. Also, I found this question https://stackoverflow.com/posts/19723311/revisions. I do the following:

  1. go to https://data.stackexchange.com/stackoverflow/
  2. run the query
select Text from PostHistory
where PostId = 19723311
  1. download the csv file
  2. read the csv in python as follows:
import pandas as pd
df = pd.read_csv('QueryResults.csv')
print('<pre><code>' in df.iloc[1].values)

The output is False, even though the string contains code. So is there another way in which code snippets are stored in data dumps of StackOverflow or is this just an inconsistency in the format of storing code snippets.

0

There are 0 answers