Я наблюдаю ту же ошибку в стабильной версии Chrome 43.0.2357.12 на Ubuntu. Похоже, это следствие изменений, связанных с DPI в Chrome 43: Chrome теперь учитывает настройки DPI , что должно быть улучшением, за исключением того, что то, что он делает с этими настройками DPI, кажется полностью нарушенным.
В качестве временного решения запустите
google-chrome --force-device-scale-factor=1
Aquí hay un script de Python que hace lo que quieres:
#!/usr/bin/env python
# -*- coding: ascii -*-
"""filter.py"""
import sys
# Get the file and the maximum line-length as command-line arguments
filepath = sys.argv[1]
maxlen = int(sys.argv[2])
# Initialize a list to store the unfiltered lines
lines = []
# Read the data file line-by-line
jsonfile = open(filepath, 'r')
for line in jsonfile:
# Only consider non-empty lines
if line:
# For "text" lines that are too line, remove the previous line
# and also skip the next two line
if "text" in line and len(line) > maxlen:
lines.pop()
next(jsonfile)
next(jsonfile)
# Add all other lines to the list
else:
lines.append(line)
# Strip trailing comma from the last object
lines[-2] = lines[-2].replace(',', '')
# Output the lines from the list
for line in lines:
sys.stdout.write(line)
Podría ejecutarlo así:
python filter.py data.json 34
Suponga que tiene el siguiente archivo de datos:
[
{
"text": "blah blah blah one",
"author": "John Doe"
},
{
"text": "blah blah blah two",
"author": "John Doe"
},
{
"text": "blah blah blah three",
"author": "John Doe"
}
]
Luego, ejecutar el script como se describe produciría el siguiente resultado:
[
{
"text": "blah blah blah one",
"author": "John Doe"
},
{
"text": "blah blah blah two",
"author": "John Doe"
}
]